package com.biz.primus.management.cat;

import com.biz.primus.account.security.HttpSecurityConfig;
import com.biz.primus.management.base.config.BaseConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;

/**
 * @author yanweijin
 * @date 2017/9/13
 */
@SpringCloudApplication
@Import(BaseConfiguration.class)
@EnableFeignClients
public class CatManagementApplication extends SpringBootServletInitializer implements EmbeddedServletContainerCustomizer {

    public static void main(String[] args) {
        new SpringApplicationBuilder(CatManagementApplication.class).web(true).run(args);
    }

    @Override
    public void customize(ConfigurableEmbeddedServletContainer container) {
    }

    /**
     * 统一cas提供的Spring Security权限扩展，如果不做扩展，可以去掉这个Bean的注册
     */
    @Bean
    public HttpSecurityConfig getHttpSecurityConfig(){
        return new HttpSecurityConfig(){

            @Override
            public void config(HttpSecurity httpSecurity) {

            }
        };
    }
}
